{% extends "base.html" %}
{% block content %}
<h1>Hi,{{g.user.nickname}}!</h1>
<form action="" method="post" name="post">
	{{form.hidden_tag()}}
	<table>
		<tr>
			<td>Say something:</td>
			<td>{{ form.post(size = 30 , maxlength = 140) }}</td>
			<td>
				{% for error in form.errors.post %}
					<span style="color: red;">[{{error}}]</span><br>
				{% endfor %}

			</td>
		</tr>
		<tr>
			<td></td>
			<td><input type="submit" name="Post!" value="发送"></td>
			<td></td>
		</tr>
	</table>
</form>
{% for post in posts.items %}
	{% include 'post.html' %}
{% endfor %}
{% if posts.has_prev %}
	<a href="{{ url_for('index', page = posts.prev_num) }}"><< Newer posts</a>
{% else %}
	<< Newer posts
{% endif %} |
{% if posts.has_next %}
	<a href="{{ url_for('index', page = posts.next_num) }}">Older posts >></a>
{% else %}
	Older posts >>
{% endif %}
{% endblock %}
